#include <iostream>

#include "range.h"

using namespace std;

std::ostream &operator <<(std::ostream &os, const Range &range) 
{
	int second = range.first + range.step;
	os << "[" << range.first;
	if (range.step != 1 && second < range.last) 
		os << ", " << second << (range.last == second + 1 ? ", " : ", ..., ");
	else 
		os << (range.last == range.first + 1 ? ", " : ", ..., ");
	os << range.last << "]";
	return os;
}

ostream &operator <<(ostream &os, const RangeIterator &range) 
{
	os << range.current;
	return os;
}

RangeIterator RangeIterator::operator ++() 
{
	current += step;
	return *this;
}
